package lol.clann.minecraft.springboot.api.model.menu;

import com.ruoshui.utils.java.random.RandomUtils;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.InventoryHolder;

/**
 * @author: zyp
 * @date: 2020/11/2 3:10 下午
 */
public class MenuInventory extends CraftInventoryCustom {
    private long menuUid;
    private long page;
    private long uid; // 唯一标识

    private MenuInventory(InventoryHolder owner, InventoryType type) {
        super(owner, type);
    }

    private MenuInventory(InventoryHolder owner, InventoryType type, String title) {
        super(owner, type, title);
    }

    private MenuInventory(InventoryHolder owner, int size) {
        super(owner, size);
    }

    public MenuInventory(InventoryHolder owner, int size, String title) {
        super(owner, size, title);
    }

    public static MenuInventory create(int page, long menuUid, int row, String title) {
        MenuInventory mi = new MenuInventory(null, row * 9, title);
        mi.menuUid = menuUid;
        mi.page = page;
        mi.uid = RandomUtils.nextLong();
        return mi;
    }

    public long getMenuUid() {
        return menuUid;
    }

    public long getUid() {
        return uid;
    }

    public long getPage() {
        return page;
    }
}
